<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import AnnouncementIcon from '@/components/icons/AnnouncementIcon.vue'
import RegistrationIcon from '@/components/icons/RegistrationIcon.vue'
import ScoreIcon from '@/components/icons/ScoreIcon.vue'
import ApprovalIcon from '@/components/icons/ApprovalIcon.vue'
import AuthorityIcon from '@/components/icons/AuthorityIcon.vue'
import SmartIcon from '@/components/icons/SmartIcon.vue'
import SecurityIcon from '@/components/icons/SecurityIcon.vue'

const router = useRouter()

// 核心功能数据
const features = ref([
  {
    id: 1,
    title: '考试信息发布',
    description: '权威、及时、准确的考试招考信息发布平台',
    iconComponent: 'AnnouncementIcon',
    color: '#4facfe'
  },
  {
    id: 2,
    title: '在线报名系统',
    description: '便捷的在线报名流程,支持多种支付方式',
    iconComponent: 'RegistrationIcon',
    color: '#7ee8fa'
  },
  {
    id: 3,
    title: '成绩查询',
    description: '快速查询考试成绩,支持多维度数据分析',
    iconComponent: 'ScoreIcon',
    color: '#00f2fe'
  },
  {
    id: 4,
    title: '资格审核',
    description: '智能化资格审核系统,提高审核效率',
    iconComponent: 'ApprovalIcon',
    color: '#4facfe'
  }
])

// 平台优势数据
const advantages = ref([
  {
    id: 1,
    title: '权威发布',
    description: '教育部门官方认证,信息真实可靠',
    iconComponent: 'AuthorityIcon'
  },
  {
    id: 2,
    title: '智能管理',
    description: '全流程数字化管理,提升工作效率',
    iconComponent: 'SmartIcon'
  },
  {
    id: 3,
    title: '安全保障',
    description: '多重安全防护,保护用户隐私数据',
    iconComponent: 'SecurityIcon'
  }
])

// 统计数据
const statistics = ref([
  { label: '服务院校', value: '500+', unit: '所' },
  { label: '累计考生', value: '100万+', unit: '人' },
  { label: '发布考试', value: '2000+', unit: '场' },
  { label: '满意度', value: '98%', unit: '' }
])

// 跳转到发布页面
const goToPublish = () => {
  router.push('/publish')
}

// 跳转到交易页面
const goToTrade = () => {
  router.push('/trade')
}
</script>

<template>
  <div class="home-page">
    <!-- Hero 区域 -->
    <section class="hero-section">
      <div class="hero-content">
        <div class="hero-text">
          <p class="hero-subtitle">智慧招考平台</p>
          <h1 class="hero-title">
            连接考生与未来<br />
            创造<span class="highlight">教育价值</span>
          </h1>
          <p class="hero-description">
            为教育考试、招生考试及智慧校园领域的专业人士提供一个公开、真实、可信赖的信息发布与交流平台
          </p>
          <div class="hero-buttons">
            <button class="btn-primary" @click="goToTrade">
              <span class="btn-icon">🔍</span>
              查找开发服务
            </button>
            <button class="btn-secondary" @click="goToPublish">
              <span class="btn-icon">➕</span>
              发布服务信息
            </button>
          </div>
        </div>
        <div class="hero-decoration">
          <div class="decoration-circle decoration-circle-1"></div>
          <div class="decoration-circle decoration-circle-2"></div>
          <div class="decoration-circle decoration-circle-3"></div>
        </div>
      </div>
    </section>

    <!-- 统计数据区域 -->
    <section class="statistics-section">
      <div class="statistics-container">
        <div
          v-for="stat in statistics"
          :key="stat.label"
          class="stat-item"
        >
          <div class="stat-value">{{ stat.value }}</div>
          <div class="stat-label">{{ stat.label }}{{ stat.unit }}</div>
        </div>
      </div>
    </section>

    <!-- 核心功能展示 -->
    <section class="features-section">
      <div class="section-header">
        <h2 class="section-title">核心功能</h2>
        <p class="section-subtitle">为您提供全方位的考试管理解决方案</p>
      </div>
      <div class="features-grid">
        <div
          v-for="feature in features"
          :key="feature.id"
          class="feature-card"
          :style="{ '--card-color': feature.color }"
        >
          <div class="feature-icon">
            <AnnouncementIcon v-if="feature.iconComponent === 'AnnouncementIcon'" :size="64" />
            <RegistrationIcon v-if="feature.iconComponent === 'RegistrationIcon'" :size="64" />
            <ScoreIcon v-if="feature.iconComponent === 'ScoreIcon'" :size="64" />
            <ApprovalIcon v-if="feature.iconComponent === 'ApprovalIcon'" :size="64" />
          </div>
          <h3 class="feature-title">{{ feature.title }}</h3>
          <p class="feature-description">{{ feature.description }}</p>
          <a href="#" class="feature-link">了解详情 →</a>
        </div>
      </div>
    </section>

    <!-- 平台优势 -->
    <section class="advantages-section">
      <div class="section-header">
        <h2 class="section-title">平台优势</h2>
        <p class="section-subtitle">专业、高效、安全的招考管理平台</p>
      </div>
      <div class="advantages-grid">
        <div
          v-for="advantage in advantages"
          :key="advantage.id"
          class="advantage-card"
        >
          <div class="advantage-image">
            <AuthorityIcon v-if="advantage.iconComponent === 'AuthorityIcon'" :size="80" />
            <SmartIcon v-if="advantage.iconComponent === 'SmartIcon'" :size="80" />
            <SecurityIcon v-if="advantage.iconComponent === 'SecurityIcon'" :size="80" />
          </div>
          <h3 class="advantage-title">{{ advantage.title }}</h3>
          <p class="advantage-description">{{ advantage.description }}</p>
        </div>
      </div>
    </section>
  </div>
</template>

<style scoped>
/* ============================================
   页面容器
   ============================================ */
.home-page {
  width: 100%;
  min-height: 100vh;
}

/* ============================================
   Hero 区域
   ============================================ */
.hero-section {
  position: relative;
  min-height: 600px;
  background: linear-gradient(180deg, #e8f5fe 0%, #f0f9ff 50%, #ffffff 100%);
  padding: 80px 48px;
  overflow: hidden;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero-text {
  max-width: 600px;
}

.hero-subtitle {
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.hero-title {
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 24px;
}

.hero-title .highlight {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 40px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(79, 172, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 16px rgba(79, 172, 254, 0.15);
}

.btn-secondary:hover {
  background: var(--bg-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.25);
}

.btn-icon {
  font-size: 18px;
}

/* 装饰元素 */
.hero-decoration {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: none;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
}

.decoration-circle-1 {
  width: 400px;
  height: 400px;
  top: -100px;
  right: -100px;
}

.decoration-circle-2 {
  width: 300px;
  height: 300px;
  top: 150px;
  right: 100px;
  background: linear-gradient(135deg, rgba(126, 232, 250, 0.15) 0%, rgba(79, 172, 254, 0.15) 100%);
}

.decoration-circle-3 {
  width: 200px;
  height: 200px;
  bottom: 50px;
  right: 50px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
}

/* ============================================
   统计数据区域
   ============================================ */
.statistics-section {
  background: white;
  padding: 60px 48px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

.statistics-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   核心功能区域
   ============================================ */
.features-section {
  padding: 80px 48px;
  background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.section-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
}

.features-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
}

.feature-card {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 4px 16px rgba(79, 172, 254, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(135deg, var(--card-color, #4facfe) 0%, #00f2fe 100%);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(79, 172, 254, 0.2);
}

.feature-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.feature-description {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.feature-link {
  display: inline-flex;
  align-items: center;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.feature-link:hover {
  color: var(--primary-light);
  transform: translateX(4px);
}

/* ============================================
   平台优势区域
   ============================================ */
.advantages-section {
  padding: 80px 48px;
  background: linear-gradient(135deg, #e8f5fe 0%, #f0f9ff 100%);
}

.advantages-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
}

.advantage-card {
  background: white;
  border-radius: 24px;
  padding: 48px 36px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(79, 172, 254, 0.12);
  transition: all 0.3s ease;
}

.advantage-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(79, 172, 254, 0.2);
}

.advantage-image {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.advantage-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.advantage-description {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
  .hero-section {
    padding: 48px 24px;
    min-height: 500px;
  }

  .hero-title {
    font-size: 36px;
  }

  .hero-description {
    font-size: 16px;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .statistics-section {
    padding: 40px 24px;
  }

  .statistics-container {
    gap: 32px;
  }

  .stat-value {
    font-size: 36px;
  }

  .features-section,
  .advantages-section {
    padding: 48px 24px;
  }

  .section-title {
    font-size: 32px;
  }

  .features-grid,
  .advantages-grid {
    gap: 24px;
  }

  .hero-decoration {
    opacity: 0.3;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .hero-section {
    padding: 64px 36px;
  }

  .hero-title {
    font-size: 44px;
  }

  .features-section,
  .advantages-section {
    padding: 64px 36px;
  }
}
</style>
